import 'dart:ffi';

import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

class RichTextDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('RichText'),
        centerTitle: true,
      ),
      body: RichText(
        text: TextSpan(
            style: DefaultTextStyle.of(context).style,
            children: <InlineSpan>[
              /*decoration 去掉Text下部自带下划线*/
              TextSpan(
                  text: '中国',
                  style: TextStyle(fontSize: 25, color: Colors.red,decoration: TextDecoration.none),
                  recognizer: TapGestureRecognizer()..onTap = () {
                    print('中国');
                  }),
              TextSpan(
                  text: ',一个有温度的',
                  style: TextStyle(fontSize: 20, color: Colors.black)),
              TextSpan(
                  text: ',国度',
                  style: TextStyle(fontSize: 20, color: Colors.red)),
            ]),
      ),
    );
  }
}
